home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Contributed / SpriteWorld / SpriteWorld Files / Utils / SWStats.h < prev   
Encoding:
Text File  |  2000-10-06  |  2.0 KB  |  79 lines  |  [TEXT/CWIE]

  1. ///--------------------------------------------------------------------------------------
  2. // SWStats.h
  3. ///--------------------------------------------------------------------------------------
  4.  
  5. #ifndef __SWSTATS__
  6. #define __SWSTATS__
  7.  
  8. #ifndef __SPRITEWORLD__
  9. #include <SpriteWorld.h>
  10. #endif
  11.  
  12.  
  13. ///--------------------------------------------------------------------------------------
  14. // Definitions
  15. ///--------------------------------------------------------------------------------------
  16.  
  17.  
  18. typedef enum
  19. {
  20.     kRightJustify = 0,
  21.     kLeftJustify
  22. } JustifyType;
  23.  
  24.  
  25.     // This structure is used for each stats box to tell the digit-drawing
  26.     // routines where to draw the numbers, and what number to draw.
  27. typedef struct
  28. {
  29.     SpriteRec        srcSpriteP;        // the Sprite
  30.     long            theNum;            // the current number (up to 10 digits long)
  31.     short            numDigits;        // how many digits can fit in the box
  32.     JustifyType     justification;    // right or left justified
  33.     Boolean            fillWithZeros;    // whether to display as 001 or just 1.
  34.     DrawProcPtr        drawProc;        // the DrawProc used to draw each digit
  35. } StatsStruct, *StatsStructPtr;
  36.  
  37.  
  38. ///--------------------------------------------------------------------------------------
  39. // Function Prototypes
  40. ///--------------------------------------------------------------------------------------
  41.  
  42. SpritePtr CreateStatsSpriteClone(
  43.     SpritePtr masterSpriteP,
  44.     short numDigits,
  45.     JustifyType justification,
  46.     Boolean fillWithZeros);
  47.     
  48. OSErr SetUpStatsSprite(
  49.     SpritePtr statsSpriteP,
  50.     SpriteLayerPtr dstSpriteLayer,
  51.     DrawProcPtr drawProcP,
  52.     short horizLoc,
  53.     short vertLoc,
  54.     long theNum);
  55.  
  56. OSErr DrawPictInFrame(
  57.     FramePtr dstFrameP, 
  58.     short pictID);
  59.  
  60. void SetStatsSpriteDrawProc(
  61.     SpritePtr srcSpriteP,
  62.     DrawProcPtr drawProc);
  63.     
  64. void SetStatsSpriteNumber(
  65.     SpritePtr srcSpriteP,
  66.     long newNumber);
  67.  
  68. long GetStatsSpriteNumber(SpritePtr srcSpriteP);
  69.     
  70. SW_FUNC void StatsItemDrawProc(
  71.     FramePtr srcFrameP,
  72.     FramePtr dstFrameP,
  73.     Rect* srcRectP,
  74.     Rect* dstRectP);
  75.  
  76. short GetNumberLength(long theNum);
  77.  
  78.  
  79. #endif /* __SWSTATS__ */